package net.lab1024.sa.admin.module.business.erp.prp.controller;

import net.lab1024.sa.admin.module.business.erp.prp.domain.form.BipordAddForm;
import net.lab1024.sa.admin.module.business.erp.prp.domain.form.BipordQueryForm;
import net.lab1024.sa.admin.module.business.erp.prp.domain.form.BipordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.prp.domain.vo.BipordVO;
import net.lab1024.sa.admin.module.business.erp.prp.service.BipordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * BIP运算单 Controller
 *
 * @Author AKITA
 * @Date 2025-08-13 14:18:32
 * @Copyright AKITA
 */

@RestController
@Tag(name = "BIP运算单")
public class BipordController {

    @Resource
    private BipordService bipordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/bipord/queryPage")

    public ResponseDTO<PageResult<BipordVO>> queryPage(@RequestBody @Valid BipordQueryForm queryForm) {
        return ResponseDTO.ok(bipordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/bipord/add")

    public ResponseDTO<Long> add(@RequestBody @Valid BipordAddForm addForm) {
        return bipordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/bipord/update")

    public ResponseDTO<String> update(@RequestBody @Valid BipordUpdateForm updateForm) {
        return bipordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/bipord/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return bipordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/bipord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return bipordService.delete(id);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/bipord/info/{id}")
    public ResponseDTO<BipordVO> info(@PathVariable Long id) {
        return bipordService.info(id);
    }


    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/bipord/passDown/{id}")
    public ResponseDTO<String> passDown(@PathVariable Long id, @RequestParam("version") Integer version ) {
        return bipordService.passDown(id,version);
    }



}
